package main

import (
	"fmt"
)

// 定义Student类型 写在引用之前
type Student struct {
}

func TypeJudge(items ...interface{}) {

	for index, x := range items {
		switch x.(type) {
		case bool:
			fmt.Printf("第%v个参数是 bool 类型，值是%v\n", index, x)
		case float32:
			fmt.Printf("第%v个参数是 float32 类型，值是%v\n", index, x)
		case float64:
			fmt.Printf("第%v个参数是 float64 类型，值是%v\n", index, x)
		case int, int32, int64:
			fmt.Printf("第%v个参数是 整数 类型，值是%v\n", index, x)
		case string:
			fmt.Printf("第%v个参数是 string 类型，值是%v\n", index, x)
		case Student:
			fmt.Printf("第%v个参数是 Student 类型，值是%v\n", index, x)
		case *Student:
			fmt.Printf("第%v个参数是 *Student 类型，值是%v\n", index, x)
		default:
			fmt.Println("第%v个参数 类型不确定", index)
		}

	}

}

func main() {
	var flag bool = true
	var float32 float32 = 96.1
	var float64 float64 = 6.22
	count := 65
	name := "tom"

	//自定义的类型 也能使用类型断言
	student1 := Student{}
	student2 := &Student{}
	TypeJudge(flag, float32, float64, count, name, student1, student2)
}
